﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HostingWithoutServiceReference
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Console Application with hosting without service reference");
            MathServiceClient mc = new MathServiceClient();
            Console.WriteLine(mc.Sum(5, 7));

            HelloWorldServiceClient mc1 = new HelloWorldServiceClient();
            Console.WriteLine(mc1.Hello("Sanjay Singh"));

            Console.ReadLine();
        }
    }

    public partial class MathServiceClient : System.ServiceModel.ClientBase<ServiceContract.IMathService>, ServiceContract.IMathService
    {
        public MathServiceClient()
            : this("MathServiceEndPoint")
        {
        }

        public MathServiceClient(string endpointConfigurationName) :
            base(endpointConfigurationName)
        {
        }

        public int Sum(int x, int y)
        {
            return base.Channel.Sum(x, y);
        }

        #region IMathService Members


        public int Substract(int from, int to)
        {
            return from - to;
        }

        #endregion
    }

    public partial class HelloWorldServiceClient : System.ServiceModel.ClientBase<ServiceContract.IHelloWorldService>, ServiceContract.IHelloWorldService
    {
        public HelloWorldServiceClient()
            : this("HelloWorldServiceEndPoint")
        {
        }

        public HelloWorldServiceClient(string endpointConfigurationName) :
            base(endpointConfigurationName)
        {
        }



        #region IHelloWorldService Members

        public string Hello(string name)
        {
            return base.Channel.Hello(name);
        }

        #endregion
    }
}
